package cn.fzkj.springcloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ConsumerController {

    @Value("${service-url.nacos-uri}")
    private String SERVICE_URI;

    @Autowired
    RestTemplate restTemplate;

    @RequestMapping(value = "/consumer/payment/nacos/{id}")
    public String getConsumer(@PathVariable("id") Long id){
        return  restTemplate.getForObject(SERVICE_URI + "/payment/nacos/" + id, String.class);
    }

}
